package com.cy.sc.service;

import com.cy.sc.pojo.Staff;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <br>@class: StaffClientServiceFallbackFactory 
 * <br>@description:
 * <br>@author: cy
 * <br>@date: 2020-04-03 09:00:19
 * <br>@version: 1.0
 * <br>
 * <br>@since: (版本) 作者 时间 注释 
 */
@Component
public class StaffClientServiceFallbackFactory implements FallbackFactory {

    @Override
    public Object create(Throwable throwable) {
        return new StaffClientService() {
            @Override
            public Staff queryById(long id) {
                return new Staff().setStaffno(id).setSname("查询服务暂时关闭");
            }

            @Override
            public List<Staff> queryAll() {
                return null;
            }

            @Override
            public boolean addStaff(Staff staff) {
                return false;
            }
        };
    }
}
